from it.unimi.dsi.webgraph import *
from it.unimi.dsi.law.rank import *
from it.unimi.dsi.law.stat import *
from java.lang import *
import os
import jarray

ITERS = 6
basedir = r'C:\jylab\examples\webmatrix'
relbasename = r'eu-2005'
basename = os.path.join(basedir, relbasename)
graph = BVGraph.loadOffline(String(basename))

pagerank = PageRank(graph)
pagerank.init()

print '[nodes = %d, links = %d]' % (graph.n, graph.m)
for i in range(ITERS):
    pagerank.step()
    if i > 0:
        tau = KendallTau.compute(pagerank.rank,
                                 pagerank.previousRank)
        print '[iter = %d, tau = %f]' % (i + 1, tau)
        
        

    
        
        
        
    
